#ifndef _PARTHUS_HW_CODEC_
#define _PARTHUS_HW_CODEC_

/******************************************************************************
 * MODULE NAME:    hw_codec.h
 * PROJECT CODE:   BlueStream
 * DESCRIPTION:    Generic Codec hardware abstraction layer
 * MAINTAINER:     Daire McNamara
 * DATE:           10 October 2001
 *
 * SOURCE CONTROL: $Id: hw_codec.h,v 1.10 2009/08/14 06:17:41 xiezc Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2001-2004 Ceva Inc.
 *     All rights reserved.
 *
 * REVISION HISTORY:
 *    10 October 2001 - DMN - Initial Version
 *
 * NOTES TO USERS:
 ******************************************************************************/

#include "sys_config.h"
#include "lc_types.h"


#define TI_TLV320AIC23B       1
#define MOTOROLA_MC145481     2

#define Codec_Type   MOTOROLA_MC145481


#define CODEC_ADDR_LEN 7
#define CODEC_DATA_LEN 9

/* Register's defination of TLV320AIC23b, which belongs to Texas Instruments*/
#define LLICVC_ADDR 0x00      /* 0000000 Left line input channel volume control*/
#define RLICVC_ADDR 0x01      /* 0000001 Right line input channel volume control*/
#define LCHPVC_ADDR 0x02      /* 0000010 Left channel headphone volume control*/
#define RCHPVC_ADDR 0x03      /* 0000011 Right channel headphone volume control*/
#define ANAUPC_ADDR 0x04      /* 0000100 Analog audio path control*/
#define DIAUPC_ADDR 0x05      /* 0000101 Digital audio path control*/
#define PWDWC_ADDR  0x06      /*  0000110 Power down control*/
#define DIAUIF_ADDR 0x07      /* 0000111 Digital audio interface format*/
#define SAPRTC_ADDR 0x08      /* 0001000 Sample rate control*/
#define DIGIAT_ADDR 0x09      /* 0001001 Digital interface activation*/
#define RESETR_ADDR 0x0F      /* 0001111 Reset register*/

void HWcodec_Initialise(void);
void HWcodec_Register_eSCO_Link(t_sco_info *p_sco_link);
void HWcodec_Unregister_eSCO_Link(t_sco_info *p_sco_link);
void HWcodec_Interrupter_Handler(void);

boolean HWcodec_Is_Valid_SCO_Conversion(u_int16 voice_setting);
void HWcodec_Set_Voice_Setting(u_int16 new_voice_setting);
u_int16 HWcodec_Get_Voice_Setting(void);
void HWcodec_Enable(void);
void HWcodec_Disable(void);
u_int8 HWcodec_Get_VCI_Clk_Sel(void);
u_int8 HWcodec_Get_VCI_Clk_Sel_Map(void);
u_int8 HWcodec_Get_VCI_Sync_Dir(void);
u_int8 HWcodec_Get_Sync_Ls(void);
void HWcodec_Increase_Volume(void);
void HWcodec_Decrease_Volume(void);
boolean HWcodec_GetStatus(void);

#if defined(SYS_HAL_VCI_CLK_OVERRIDE_SUPPORTED)
typedef enum {
    HW_CODEC_VCI_CLK_DEFAULT=0,
    HW_CODEC_VCI_CLK_64kHz=1,
    HW_CODEC_VCI_CLK_200kHz=2,
    HW_CODEC_VCI_CLK_256kHz=3,
    HW_CODEC_VCI_CLK_512kHz=4,
    HW_CODEC_VCI_CLK_1000kHz=5,
    HW_CODEC_VCI_CLK_1024kHz=6
} t_VCI_SCO_CLK_Freq;

u_int8 HWcodec_VCI_CLK_Override(t_VCI_SCO_CLK_Freq clk_freq);
boolean HWcodec_Is_VCI_CLK_Override_Enabled(void);
void HWcodec_VCI_CLK_Override_Enable(u_int8 vci_clk_sel, u_int8 vci_clk_sel_map, u_int8 codec_type, u_int8 sco_cfg0);
void HWcodec_VCI_CLK_Override_Disable(void);
#endif

#endif

